package com.bookmarket.service.impl;

import com.bookmarket.dao.LQReturnOrderMapper;
import com.bookmarket.entity.Accident;
import com.bookmarket.entity.Content;
import com.bookmarket.service.LQReturnOrderService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("returnOrderService")
public class LQReturnOrderServiceImpl implements LQReturnOrderService {

    @Resource
    private LQReturnOrderMapper returnOrderMapper;

    @Override
    public void addAccident(Accident accident) {
        returnOrderMapper.addAccident(accident);
    }

    @Override
    public int getAllAccident() {
        return returnOrderMapper.getAllAccident();
    }

    @Override
    public Page queryAccident(int currentPage,int pageSize,Accident accident) {
        Page page = PageHelper.startPage(currentPage,4);
        List<Accident> list = returnOrderMapper.queryAccident(accident);
        return page;
    }

    @Override
    public List<Content> queryAllFriends(int id) {
        return returnOrderMapper.queryAllFriends(id);
    }

    @Override
    public List<Content> queryAllContent(int adminId,int customId) {
        Content content = new Content();
        content.setAdminId(adminId);
        content.setCustomId(customId);
        List<Content> list = returnOrderMapper.queryAllContent(content);
        return list;
    }

    public void setReturnOrderMapper(LQReturnOrderMapper returnOrderMapper) {
        this.returnOrderMapper = returnOrderMapper;
    }
}
